[GENERAL] Geometric, getting x and y co-ordinates from point datatype - Mailing list pgsql-general

From Stuart Rison
Subject [GENERAL] Geometric, getting x and y co-ordinates from point datatype
Date
Msg-id v04020a00b37d50fecaed@[128.40.242.190]
Whole thread Raw
Responses Re: [GENERAL] Geometric, getting x and y co-ordinates GOING MAD!!!!!  (Stuart Rison <stuart@ludwig.ucl.ac.uk>)
List pgsql-general
Hi there,

Suppose you have a table:

id     pos
1    (0,5)
2    (-1,6)
3    (5.5,9.8)

Are there functions to get to the individual coords such that

SELECT id,get_x(pos),get_y(pos) FROM table;

gives

id    get_x    get_y
1    0    5
2    -1    6
3    5.5    9.8

From doing a bit of snooping about in the Programmer's Guide, I can only
assume that this would involve a modified version point_out.

Are these functions already out there?
If not, can someone give me pointers to the answer?
Would the solution indeed be a modified version of point_out and if so, can
someone give me the point_out source to work with?
(I don't program in C -hell, I don't really program in anything, I dabble-
but I'm quite happy to experiment)

Regards,

Stuart.




+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street               |
| Tel. (0171) 878 4041    | London, W1P 8BT, UNITED KINGDOM.     |
| Fax. (0171) 878 4040    | stuart@ludwig.ucl.ac.uk              |
+-------------------------+--------------------------------------+

pgsql-general by date:

Previous
From: jim@reptiles.org (Jim Mercer)
Date:
Subject: Re: [GENERAL] Question about indexes.
Next
From: James Thompson
Date:
Subject: Re: [GENERAL] Embedded SQL in 'C' (cursors)